package com.hzit.servlet;

import cn.hutool.core.util.StrUtil;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.hzit.common.utils.PageResult;
import com.hzit.common.utils.R;
import com.hzit.common.utils.ResponseUtil;
import com.hzit.entity.Classes;
import com.hzit.entity.Student;
import com.hzit.service.ClassesService;
import com.hzit.service.StudentService;
import com.hzit.service.impl.ClassesServiceImpl;
import com.hzit.service.impl.StudentServiceImpl;
import com.hzit.vo.StudentVO;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;

@WebServlet("/classes")
public class ClassesServlet extends HttpServlet {
	private ClassesService classesService;

	@Override
	public void init() throws ServletException {
		classesService = new ClassesServiceImpl();
	}
	protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// response.setContentType("application/json;charset=utf8");
		List<Classes> classesList = classesService.findAll();
		ResponseUtil.write(response,R.ok().data("list",classesList));
	}


}
